package com.situ.controller;

import com.situ.service.Statistics01Service;
import com.situ.service.StatisticsService;
import com.situ.service.impl.Statistics01ServiceImpl;
import com.situ.service.impl.StatisticsServiceImpl;
import com.situ.util.BaseController;
import com.situ.vo.LayuiTableVO;
import com.situ.vo.StatisticsVO;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/statistics01")
public class Statistics01Controller extends BaseController {
    private static final long serialVersionUID = 1L;

//    Statistics01Service service =new Statistics01ServiceImpl();
StatisticsService service =new StatisticsServiceImpl();

    public void page(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.getRequestDispatcher("/WEB-INF/statistics01.jsp").forward(request, response);
    }

    public LayuiTableVO list(Integer page, Integer limit, String keyword) {

        List<StatisticsVO> list = service.all(page, limit, keyword);
        LayuiTableVO vo = new LayuiTableVO();
        vo.setCode(0);
        vo.setData(list);
        vo.setCount(service.count(keyword));
        //vo.setCount(100L);
        return vo;
    }
}
